home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / kbflag.arc / KBFLAG.DOC < prev   
Text File  |  1986-11-28  |  2KB  |  39 lines

  1.  
  2. KBFLAG -- by Nico Mark -- from PC Magazine, December 23, 1986 
  3.  
  4. KBFLAG can be used to cause branching in batch files, so that execution of
  5. different parts of the file can be dependent on the state of toggle and shift
  6. keys.  You can, for example, abort execution of AUTOEXEC.BAT if the CapsLock
  7. key has been toggled while CONFIG.SYS in running.
  8.  
  9. KBFLAG tests for a keystroke in the buffer, and sets errorlevel to the value of
  10. the key's KBFLAG in the ROM BIOS.  Thus, if the Ins key has been toggled, it
  11. will return an errorlevel of 128.  Other values are:  
  12.  
  13.     1 = Right Shift 
  14.     2 = Left Shift 
  15.     4 = Ctrl key 
  16.     8 = Alt key
  17.        16 = ScrollLock 
  18.        32 = NumLock 
  19.        64 = CapsLock 
  20.       128 = Ins 
  21.  
  22. (You can use sums of these values to correspond to combinations of keys, so
  23. 96 = CapsLock and NumLock together.) 
  24.  
  25. If you put these lines at the start of autoexec.bat-- 
  26.  
  27.     KBFLAG 
  28.     IF ERRORLEVEL 64 GOTO :END 
  29.  
  30. --and put the label :END at the end of the file, autoexec.bat will then check 
  31. to see if CapsLock has been pressed, and will jump the end of the batch if it
  32. has.   To prevent autoexec.bat from executing on bootup, simply hit CapsLock
  33. while  config.sys is running.     
  34.  
  35. You can use variations of this technique to cause different sets of programs
  36. to run during autoexec.bat (or any batch file).  For example, Caps Lock could
  37. cause only a few programs to run; Alt + CapsLock could cause others; etc.
  38.  
  39.